/*
 * @authors :Bin Mei
 * @date    :2017-04-26
 * @description：票交汇APP-h5
 */


module.exports = (domain)=>{
	domain.Open = (key, props)=>{
		domain.setState({
		  [`${key}`]: true,
		  props
		});
	}
	domain.Close = (key)=>{
		domain.setState({
		  [`${key}`]: false,
		});
	}
	domain.inputs = (e,callback)=>{
		let {value,name}=e.target;
		domain.setState({
		  [`${name}`]: value.trim(),
		},()=>{callback&&callback()});
	}
	domain.clear = (key)=>{
		let value = domain.state[`${key}`];
		if(!value||value==''){
			return false;
		};

		domain.setState({[`${key}`]:''});
	}

	domain.toggle=(key)=>{
		//开关
		domain.setState({[`${key}`]:!domain.state[`${key}`]});
	}

};